      package inet.sms.process;
      
      import inet.util.Queue;
      import inet.util.StringTool;
      import java.io.FileInputStream;
      import java.io.IOException;
      import java.io.PrintStream;
      import java.util.Collection;
      import java.util.Collections;
      import java.util.Hashtable;
      import java.util.Iterator;
      import java.util.Map;
      import java.util.Properties;
      import java.util.Vector;
      
      public class ServiceConfig
      {
      static String help19001568 = "Cong ty Truyen Thong iNET\niNET.com.vn\n04.7686588";
      static String help19001588 = "Soan:\nXSTD,XSHCM\nTT:ThoiTiet\nTG:TyGia\nVANG\nATM\nLICH\nDL:DuLich\nDN:DanhNgon\nTC:TruyenCuoi\nEMAIL\nDNS:Domain\nTDAV:TuDien\n500d/tin\n[iNET,04.7686588]";
      static String help19001727 = "Xem diem thi,soan:\nDT SoBaoDanh\nXem diem chuan:\nDC MaTruong\nLay danh sach truong da co diem/diem chuan:\nDT DS KhuVuc\nDC DS KhuVuc\nKhuVuc:\nHN,HCM,DN\nCT(CanTho)";
      
      static String invalidAll = "Tin nhan sai! Soan HELP de lay danh sach dich vu hoac goi 04.7686566 de duoc ho tro\n\niNET.com.vn";
      static String serivce_number_80xx = "8076";
      static String serivce_number_81xx = "8176";
      static String serivce_number_82xx = "8276";
      static String serivce_number_83xx = "8376";
      static String serivce_number_84xx = "8476";
      static String serivce_number_85xx = "8576";
      static String serivce_number_86xx = "8676";
      static String serivce_number_87xx = "8776";
      
     static Vector codesList = new Vector();
     static Map codesTable = new Hashtable();
        private static final String fileName = "./conf/service.conf";
     static boolean isXSChoEnabled = true;
     static Vector processorsList = new Vector();
     private static Properties properties = new Properties();
      
        private static int getIntProperty(String propName, int defaultValue)
        {
        return Integer.parseInt(properties.getProperty(propName, Integer.toString(defaultValue)));
        }
      
        public static void loadProperties()
          throws IOException
        {
        System.out.println("Reading configuration file ./conf/service.conf...");
        FileInputStream propsFile = new FileInputStream("./conf/service.conf");
        properties.load(propsFile);
        propsFile.close();
        int n = getIntProperty("xs_cho_enabled", 1);
        if (n == 1)
          isXSChoEnabled = true;
          else {
          isXSChoEnabled = false;
          }
        serivce_number_80xx = properties.getProperty("serivce_number_80xx", serivce_number_80xx);
        serivce_number_81xx = properties.getProperty("serivce_number_81xx", serivce_number_81xx);
        serivce_number_82xx = properties.getProperty("serivce_number_82xx", serivce_number_82xx);
        serivce_number_83xx = properties.getProperty("serivce_number_83xx", serivce_number_83xx);
        serivce_number_84xx = properties.getProperty("serivce_number_84xx", serivce_number_84xx);
        serivce_number_85xx = properties.getProperty("serivce_number_85xx", serivce_number_85xx);
        serivce_number_86xx = properties.getProperty("serivce_number_86xx", serivce_number_86xx);
        serivce_number_87xx = properties.getProperty("serivce_number_87xx", serivce_number_87xx);
//        System.out.println(serivce_number_87xx);
//        System.out.println(serivce_number_80xx);
        int i = 1;
        for (; ; ++i) {
          String tempStr = properties.getProperty("processor_" + i);
          if (tempStr == null) break;
          System.out.println("processor_" + i + "=" + tempStr);
          int idx = tempStr.indexOf("-");
          if (idx <= 0) {
            System.out.println("Seperator '-' is NOT found.");
            }
            else {
            String codes = tempStr.substring(0, idx).trim();
            String proc = tempStr.substring(idx + 1).trim();
              try
              {
              Class c = Class.forName(proc);
              Processor processor = (Processor)c.newInstance();
              Queue q = new Queue();
              processor.setRequestQueue(q);
              processorsList.add(processor);      
              Collection cCodes = StringTool.parseStringEx(codes);
              for (Iterator it = cCodes.iterator(); it.hasNext(); ) {
                String code = (String)it.next();
                code = code.toUpperCase();
                codesTable.put(code, q);
                codesList.add(code);
                }
              } catch (IllegalAccessException localIllegalAccessException) {
              } catch (InstantiationException localInstantiationException) {
              } catch (ClassNotFoundException ex) {
              ex.printStackTrace(); }
            }
          }
        Collections.sort(codesList);
        Collections.reverse(codesList);
        }
      
        public static void main(String[] args)
        {
        }
      }

